<!DOCTYPE HTML>
<html>
<head>

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>RRKEMR_Print002</title>
	<script type="text/javascript" src="../third-party/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
</head>
<body>
    <h1>RRKEMR_Print002</h1>

	<h2><input type="button" id="btn02" value="My Iframe打印"></h2>
    <!--style给定宽度可以影响编辑器的最终宽度-->
    <script type="text/plain" id="myEditor">
        <p>这里我可以写一些输入提示</p>
    </script>
    <script type="text/javascript">
        var editor01 = UE.getEditor('myEditor',{
            //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
            toolbars:[['FullScreen', 'Source', 'Undo', 'Redo','Bold','test', 'print']],
            //focus时自动清空初始化时的内容
            autoClearinitialContent:true,
            //关闭字数统计
            wordCount:false,
            //关闭elementPath
            elementPathEnabled:false,
            //默认的编辑区域高度
            initialFrameHeight:300
            //更多其他参数，请参考ueditor.config.js中的配置项
        });
		$(function(){
			var btn02 = $('#btn02');
			
			btn02.on('click', function(){
				var UE_html = editor01.getAllHtml();
				// console.log( UE_html );
				// return false;
				
				var $ifr_00 = $('#ifr_00');
				if($ifr_00.length == 0){
					var tplIfr = '<iframe id="ifr_00" style="width:0;height:0;"></iframe>';
					$('body').append( tplIfr );
				}
				setTimeout(function(){
					$ifr_00 = $('#ifr_00');
					if($ifr_00[0]){
						var _ifr = $ifr_00[0];
						var _doc = _ifr.contentWindow.document;
						
						_doc.open();
						_doc.write( UE_html );
						_doc.close();
						
						setTimeout(function(){
							_ifr.contentWindow.print();
							console.log( $ifr_00[0].contentWindow.document );
						}, 30);
						
						// console.log( $ifr_00[0].contentWindow );
						// console.log( $ifr_00[0].contentDocument );
						
					}
				},1);
			});
		});
    </script>

</body>


</html>
